package com.guomao;

import java.util.Arrays;

public class JavaDemo10 {

    public static void main(String[] args) {

//      动态初始化
        int[] ages = new int[3];

        System.out.println(ages);
        //[I@4c873330

        System.out.println(ages[0]);//0

        String[] names = new String[5];
//        String names[] = new String[5];

        System.out.println(names[0]);

        boolean[] flags = new boolean[2];
        System.out.println(flags[0]);


        names[0] = "root";

        names[3] = "admin";

        System.out.println(names[0]);
        System.out.println(names[1]);

//        静态初始化
//        String [] countries = new String[]{"india","bajisitan"};

        String[] countries = {"CHINA", "USA"};

        System.out.println(countries[0]);

        System.out.println(countries.length);


        for (int i = 0; i < countries.length; i++) {
            System.out.println(countries[i]);
        }


//        System.out.println(countries[10]);

        String string = Arrays.toString(ages);

        System.out.println(string);
        //ArrayIndexOutOfBoundsException
    }


    public static String[] method(String[] arr) {

        return arr;
    }
}
